from multiprocessing import Queue, Process

import os, time, random


def write(q):
    for i in ['A', 'B', 'C']:
        q.put(i)
        time.sleep(random.random())


def read(q):
    while True:
        print(q.get(True))


if __name__ == '__main__':
    q = Queue()
    pw = Process(target=write, args=(q,))
    pr = Process(target=read, args=(q,))
    pw.start()
    pr.start()
    pw.join()
    pr.terminate()
